package com.wave.wavesystem.ai.pojo.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Table;
import com.wave.common.model.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Setter;


@Data
@Table("ai_conversation")
@EqualsAndHashCode(callSuper = true)
public class AiConversation extends BaseEntity {

    @Column(value = "userId", comment = "用户id")
    private Long userId;

    @Column(value = "conversationId", comment = "会话id")
    private String conversationId;

    @Column(value = "title", comment = "会话标题")
    private String title;

    @Column(value = "totalTokens", comment = "总消息数")
    private Integer totalTokens;

    @Column(value = "totalMessages", comment = "总token消耗")
    private Integer totalMessages;

    public void setTitle(String title) {
        if (title.length() <= 50) {
            this.title = title;
        } else {
            this.title = title.substring(0, 50);
        }

    }

}